﻿using DataAccess.Entities;
using FluentNHibernate.Mapping;

namespace DataAccess.Mappings
{
    public class MediaMap : ClassMap<Media>
    {
        public MediaMap()
        {
            Id(x => x.Id);
            Map(x => x.Title);
            Map(x => x.Description);
            References(x => x.Owner);
            Map(x => x.Url);
            HasManyToMany(x => x.Tags).Cascade.All().Table("Tags");
            HasMany(x => x.Categories).Inverse().Cascade.All();
            HasMany(x => x.Comments);
        }
    }
}
